<template>
    <div>
        <el-bread></el-bread>
        <el-button type="primary"  plain class="btn" @click="add">添加</el-button>
        <v-list @edit="edit" ></v-list>
        <v-dialog :isShow="isShow" :isAdd="isAdd" @close="close" ref="dialogRef"></v-dialog>
    </div>
</template>
<script lang="ts" setup>
import {ref,reactive} from "vue"
import vList from "./list.vue"
import vDialog from "./dialog.vue"
 let isShow = ref(false)
 let isAdd = ref(true)

 let dialogRef = ref()

 // 封装添加事件
 const add = () =>{
    isShow.value = true
    isAdd.value = true
 }

// 封装取消事件
const close = () =>{
    isShow.value = false
}

// 封装编辑事件
const edit = (e:number) =>{
    // console.log(e);
    isAdd.value = false
    isShow.value = true
    dialogRef.value.lookup(e)
  
} 





</script >
<style scoped>
 .btn{
    margin: 10px;
    margin-left: 0;
 }
</style>